package com.sailfish.springbootdemo.dao.db1;

import com.sailfish.springbootdemo.common.DB1TableName;
import com.sailfish.springbootdemo.pojo.db1.DeviceUse;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

public interface DeviceUseDao {

    /**
     * 查询
     *
     * @param status
     * @return
     */
    @Results(id = "deviceUseResultMap", value = {
            @Result(column = "device_use_id", property = "deviceUseId", jdbcType = JdbcType.INTEGER),
            @Result(column = "device_use_name", property = "deviceUseName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.DATETIMEOFFSET),
            @Result(column = "update_time", property = "updateTime", jdbcType = JdbcType.DATETIMEOFFSET),
            @Result(column = "sort", property = "sort", jdbcType = JdbcType.INTEGER),
            @Result(column = "status", property = "status", jdbcType = JdbcType.INTEGER),
    })
    @Select("select * from " + DB1TableName.DEVICE_USE + " where status = #{status}")
    List<DeviceUse> getAllDeviceUse(@Param("status") Integer status);
}
